<!-- Dom模板 -->
<template>
  <!-- <div class="animate__animated animate__slideInRight"> -->
  <!-- <transition name="hua"> -->
  <div id="box" v-if="flag">
    <div class="box">
      <!-- Dom内容 -->

      <div class="tit-1">
        <span @click="goHome" class="tit-1-left"
          ><i class="iconfont icon-lt"></i
        ></span>
        <span class="tit-1-right">故事详情</span>
      </div>
      <div v-for="(item, index) in data" :key="index">
        <div v-if="item.softContent !== ''" class="tit">
          {{ item.bookName }}
        </div>
        <p class="tit-C">2020-02-22</p>
        <div class="cons">
          <img src="../../../../static/img/图片 2@1x (2).png" alt="" />
          <div class="con-1">
            {{ item.softContent }}
          </div>
        </div>
      </div>
    </div>
    <!-- </transition> -->
  </div>
</template>

<script>
// import a from './a'; // 引入组件
import * as api from "../../api/home";
export default {
  name: "",
  data() {
    return {
      msg: "测试",
      data: [],
      flag: true,
    };
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created() {},
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted() {
    //拿到book接口
    api.bookData().then((res) => {
      this.data = res.data.code;
      console.log(res.data.code);
      console.log(this.data.splice(1, 43));
    });
  },
  // Vue方法定义
  methods: {
    goHome() {
      this.$router.push("/home");
      this.flag = false;
    },
  },
};
</script>

<style scoped>
@import url("../../../assets/font/iconfont.css");
/* @import url(''); 引入css类 */
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
.box {
  background: rgb(255, 255, 255);
  width: 100%;
  height: 100vh;
  position: absolute;
  z-index: 1000000;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  overflow-y: auto;
}
/* .no {
  animation: rwxqRight 0.3s cubic-bezier(0.215, 0.61, 0.355, 1) 0s 1;
} */
@keyframes rwxqRight {
  0% {
    /* opacity: 0; */
    transform: translateX(0, 0, 0);
  }
  100% {
    /* transform: none; */
    transform: translateX(300px, 0, 0);
  }
}
#box {
  animation: bounceInLeft 0.3s cubic-bezier(0.215, 0.61, 0.355, 1) 0s 1
    alternate forwards;
}
@keyframes bounceInLeft {
  0% {
    /* opacity: 0; */
    transform: translate3d(300px, 0, 0);
  }
  100% {
    /* transform: none; */
    transform: translate3d(0px, 0, 0);
  }
}
.tit-1 {
  width: 100%;
  height: 50px;
  /* background: wheat; */
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #ccc;
  text-align: center;
  line-height: 50px;
}
.tit-1-left {
  margin-left: 16px;
  font-weight: 600;
  color: rgb(195, 195, 195);
}
.tit-1-right {
  margin-right: 40%;
  font-size: 18px;
  /* margin-top: 4px; */
  font-weight: 600;
}
.tit-1-right i {
  line-height: 44px;
  font-size: 32px;
}
.tit {
  width: 80%;
  height: 25px;
  margin: 23px 0 10px 18px;
  font-size: 18px;
  font-weight: 600;
}
.tit-C {
  font-weight: normal;
  font-size: 14px;
  margin: 10px 18px;
  color: rgb(170, 170, 170);
}
.cons {
  width: 90%;
  height: calc(100vh - 152px);
  margin: 0 auto;
}
.con img {
  width: 100%;
  height: 168px;
}
</style>